from python_program3.class_car import Car


class ElectricCar(Car):
    """电动汽⻋的独特之处"""

    def __init__(self, make, model, year):
        super().__init__(make, model, year)
        self.battery_size = 0

    def describe_battery(self):
        print(f"This car has a {self.battery_size}-kWh battery.")

    def fill_gas_tank(self):
        print("this car does not have a gas tank!")


# my_leaf = ElectricCar('Tesla', 'Tesla', 2021)
# print(my_leaf.get_descriptive_name())
# my_leaf.describe_battery()
# my_leaf.fill_gas_tank()


class Battery:
    """⼀次模拟电动汽⻋电瓶的简单尝试"""

    def __init__(self, battery_size=40):
        """初始化电池的属性"""
        self.battery_size = battery_size

    def describe_battery(self):
        """打印⼀条描述电池容量的消息"""
        print(f"This car has a {self.battery_size}-kWh battery.")

    def get_range(self):
        """打印⼀条描述电池续航⾥程的消息"""
        range = 0
        if self.battery_size == 40:
            range = 150
        elif self.battery_size == 65:
            range = 225
        print(f"This car can go about {range} miles on a full charge.")


class ElectricCarSimple(Car):
    """电动汽⻋的独特之处"""

    def __init__(self, make, model, year):
        super().__init__(make, model, year)
        self.battery = Battery()
